parser grammar AnasintGDL;

options {
  language = Java;
  tokenVocab = AnalexGDL;
}

@header {
  package Practica6.Ambiguedad;
}

@members {
  private ArrayList<String> errors = new ArrayList<String>();
  public void displayRecognitionError(String[] tokenNames, RecognitionException e) {
    String hdr = getErrorHeader(e);
    String msg = getErrorMessage(e, tokenNames);
    errors.add(hdr + " " + msg);
  }
   
  public ArrayList<String> getErrors() {
    return errors;
  }
}

entrada: sentencia;
sentencia: KEYWORD_GRAPH COLON LEFT_BRACE node (node|edge)* RIGHT_BRACE;
node: OBJECT_NODE COLON LEFT_BRACE (attr_node)* RIGHT_BRACE;
edge: OBJECT_EDGE COLON LEFT_BRACE (attr_edge)* RIGHT_BRACE;
attr_node: ATTR_NODE COLON (STRING | VALUE_NONE | VALUE_DOTTED);
attr_edge: ATTR_EDGE COLON (STRING | VALUE_NONE | VALUE_DOTTED); 